<tagLib name="html" />
<include file="Public:header" />
    <script type="text/javascript">
        function update() {
            ThinkAjax.sendForm('dataForm', '__URL__/update', complete, 'result');
        }
        function complete(data, status) {
            if (status == 1) {
                alert("操作成功");
                window.setTimeout(function() {
                    window.location.href = '__URL__',20000
                });
            } else {
                alert("操作失败");
            }
        }
    </script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top"
            background="__PUBLIC__/images/mail_leftbg.gif"><img
                src="__PUBLIC__/images/left-top-right.gif" width="17" height="29"/></td>
        <td width="935" valign="top"
            background="__PUBLIC__/images/content-bg.gif">
            <table width="100%" height="31" border="0" cellpadding="0"
                   cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">商品管理</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top"
            background="__PUBLIC__/images/mail_rightbg.gif"><img
                src="__PUBLIC__/images/nav-right-bg.gif" width="16" height="29"/></td>
    </tr>
    <tr>
        <td height="71" valign="middle"
            background="__PUBLIC__/images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <table width="100%" height="138" border="0" cellpadding="0"
                   cellspacing="0">
                <tr>
                    <td height="13" valign="top">&nbsp;</td>
                </tr>
                <tr>
                    <td valign="top">
                        <table width="98%" border="0" align="center" cellpadding="0"
                               cellspacing="0">
                            <tr>
						<td class="left_txt">当前位置：<a href="__URL__">商品管理</a></td>
                            </tr>
                            <tr>
                                <td height="20">
                                    <table width="100%" height="1" border="0" cellpadding="0"
                                           cellspacing="0" bgcolor="#CCCCCC">
                                        <tr>
                                            <td></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <table width="100%" height="31" border="0" cellpadding="0"
                                           cellspacing="0" class="nowtable">
                                        <tr>
                                            <td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;商品明细</td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <form id="dataForm" name="dataForm" method="POST" action="__URL__/update" enctype="multipart/form-data">
                                            <input type="hidden" name="id" value="{$vo.id}"/>
                                            <tr>
                                                <td width="10%" height="30" align="right" bgcolor="#f2f2f2"
                                                    class="left_txt2">产品编号：
                                                </td>
                                                <td width="90%" height="30" bgcolor="#f2f2f2"><input name="product_no" type="text" id="product_no" size="30" value="{$vo.product_no}"/></td>
                                            </tr>
                                            <tr>
                                                <td height="30" align="right" class="left_txt2">产品名称：</td>
                                                <td height="30"><input type="text" name="product_name"
                                                                       size="30" id="product_name"
                                                                       value="{$vo.product_name}"/></td>
                                            </tr>
                                            <tr>
                                                <td height="30" align="right" class="left_txt2">原始价格：</td>
                                                <td height="30">
                                                	<input type="text" name="original_price" size="30" id="original_price" value="{$vo.original_price}" onblur="com.gowholesale.admin.Product.calculateCurrentPrice($('#original_price').val(),$('#discount').val(),'current_price')"/>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="30" align="right" class="left_txt2">折扣：</td>
                                                <td height="30">
                                                	<input type="text" name="discount" size="30" id="discount" value="{$vo.discount}" onblur="com.gowholesale.admin.Product.calculateCurrentPrice($('#original_price').val(),$('#discount').val(),'current_price')"/>%
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="30" align="right" class="left_txt2">出售价格：</td>
                                                <td height="30">
                                                	<input type="text" name="current_price" size="30" id="current_price" value="{$vo.current_price}" onblur="com.gowholesale.admin.Product.calculateDiscount($('#original_price').val(),$('#current_price').val(), 'discount')"/>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="30" align="right" class="left_txt2">描述：</td>
                                                <td>
                                                    <textarea class="ckeditor" cols="80" id="description"
                                                              name="description" rows="15">
                                                        {$vo.description}
                                                    </textarea>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="30" align="right" class="left_txt2">商品分类：</td>
                                                <td height="30">
                                                    <volist name="vo.Categories" id="cg">
                                                        {$cg.category_name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                    </volist>
                                                    <br/>
                                                    <select id="list_category" name="list_category[]"
                                                            multiple="multiple" style="width: 200px;height:250px;">
                                                        <volist name="categories" id="category">
                                                            <option value="{$category.id}"
                                                                    >{$category.category_name}
                                                            </option>
                                                        </volist>
                                                    </select>
                                                    <script type="text/javascript">
                                                        var aryValue = new Array();
                                                        <volist name = "vo.Categories" id = "category"> 
                                                        	aryValue[{$category.id}] = '{$category.id}';
                                                        </volist>
                                                        var s = document.getElementById("list_category");
                                                        for (var i = 0; i < s.options.length; i++) {
                                                            for (var j = 0; j < aryValue.length; j++) {
                                                                if (s.options[i].value == aryValue[j]) {
                                                                    s[i].selected = "selected";
                                                                    break;
                                                                }
                                                            }
                                                        }
                                                    </script>
                                            </tr>
                                            <tr>
                                                <td height="30" align="right" class="left_txt2">商品尺寸：</td>
                                                <td height="30">
                                                    <volist name="size" id="sizeMap">
                                                        <input type="checkbox" name="size_list[]"
                                                               value="{$sizeMap.id}"/>{$sizeMap.code_name}&nbsp;&nbsp;&nbsp;
                                                    </volist>
                                                    <script type="text/javascript">
                                                        var aryValue = new Array();
                                                        <volist
                                                        name = "vo.ProductSpecs"
                                                        id = "productSpec" >
                                                                aryValue[{$productSpec.size
                                                        }]
                                                        = '{$productSpec.size}';
                                                        </volist>
                                                        var s = document.getElementsByName("size_list[]");
                                                        for (var i = 0; i < s.length; i++) {
                                                            for (var j = 0; j < aryValue.length; j++) {
                                                                if (s[i].value == aryValue[j]) {
                                                                    s[i].checked = "checked";
                                                                    break;
                                                                }
                                                            }
                                                        }
                                                    </script>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="30" align="right" class="left_txt2">商品图片：</td>
                                                <td height="30"><input name="pic" id="pic"
                                                                       type="hidden" value="{$vo.pic}"/>
                                                    <input name="pic_u" id="pic_u" type="file"/>
                                                    <img src="{$upload_dir_access_uri}{$vo.pic}" alt="{$vo.product_no}"
                                                         width="120px" heigth="80px"></td>
                                            </tr>
											<tr>
												<td height="30" align="right" class="left_txt2">推荐：</td>
												<td height="30">
													<select id="featured" name="featured">
														<option value="1">Y</option>
														<option value="0">N</option>
													</select>
												</td>
											</tr>
											<tr>
												<td height="30" align="right" class="left_txt2">排序：</td>
												<td height="30">
													<input name="featured_order_key" type="text" id="featured_order_key" size="30" />
												</td>
												<script type="text/javascript">
													document.getElementById("featured_order_key").value='{$vo.featured_order_key}';
												</script>
											</tr>
											<tr>
												<td height="30" align="right" class="left_txt2">Best sellers：</td>
												<td height="30">
													<select id="best_sellers" name="best_sellers">
														<option value="1">Y</option>
														<option value="0">N</option>
													</select>
												</td>
											</tr>
											<tr>
												<td height="30" align="right" class="left_txt2">排序：</td>
												<td height="30">
													<input name="best_sellers_order_key" type="text" id="best_sellers_order_key" size="30" />
												</td>
												<script type="text/javascript">
													document.getElementById("best_sellers_order_key").value='{$vo.best_sellers_order_key}';
												</script>
											</tr>
                                            <tr>
                                                <td width="50%" height="30" align="center" colspan="2">
                                                	<input type="submit" value="Submit" name="B1"/>
                                                    &nbsp;&nbsp;&nbsp; 
                                                    <input type="reset" value="Reset" name="B12"/>
                                                </td>
                                            </tr>
                                        </form>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
</body>
</html>